import 'package:flutter/material.dart';
import 'flipper/back_page.dart';
import 'flipper/front_page.dart';
import 'flipper/page_flipper.dart';
import 'moon_box/pack_box.dart';

void main() {
  runApp(MyApp());
}

// PageFlipper：卡片翻页动画
// PackBox：打包动画
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    final animateKey = GlobalKey<PackBoxState>();
    return MaterialApp(
      title: '动画',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Stack(
        alignment: Alignment.bottomCenter,
        children: [
          PackBox(
            key: animateKey,
          ),
          Positioned(
              child: TextButton(
                onPressed: () {
                  animateKey.currentState!.pack();
                },
                child: Icon(Icons.flip),
              ),
              bottom: 30,
              width: 40,
              height: 40),
        ],
      ),
    );
  }
}
